<script>
    export default {
        onLaunch(options) {
            this.$store.dispatch("initApp", options);
            this.$store.dispatch('getMessageIds'); //获取模板消息
            // #ifdef MP-WEIXIN
            this.$store.dispatch('mp_update');
            // #endif
            // #ifdef H5
            if (typeof location.entryUrl === 'undefined' || location.entryUrl === '') {
                location.entryUrl = location.href
            }
            // #endif
          var _self = this;
          // #ifdef MP-WEIXIN
          uni.authorize({
            scope:'scope.userLocation',
            success(){
              uni.getLocation({
                type: 'wgs84',
                success: function (res) {
                  _self.$store.state.lat =res.latitude;
                  _self.$store.state.lng =res.longitude;
                },fail:function (res) {
                  uni.showModal({
                    title: '提示',
                    content: '请先在设置页面打开“地理位置”使用权限',
                    confirmText: '去设置',
                    cancelText: '算了',
                    success: data => {
                      if (data.confirm) {
                        uni.openSetting();
                      }
                    }
                  });
                },complete:function (e) {
                  console.log(e)
                }
              });
            }
          })
          // #endif
          // #ifdef H5
          uni.getLocation({
            type: 'wgs84',
            success: function (res) {
              console.log('当前位置的经度：' + res.longitude);
              console.log('当前位置的纬度：' + res.latitude);
              _self.$store.state.lat =res.latitude;
              _self.$store.state.lng =res.longitude;
            }
          })
          // #endif
        },
        onShow: function() {
          uni.hideTabBar({
              animation: false
          });


        },

    };
</script>
<style lang="scss">
    @import "./static/css/iconfont.css";
    @import "./static/css/icons.scss";
    @import 'tour.css';
    @import "node_modules/uview-ui/index.scss";
    view,
    scroll-view,
    swiper,
    swiper-item,
    cover-view,
    cover-image,
    icon,
    text,
    rich-text,
    progress,
    button,
    checkbox,
    form,
    input,
    label,
    radio,
    slider,
    switch,
    textarea,
    navigator,
    audio,
    camera,
    image,
    video {
        box-sizing: border-box;
    }
    .u-scroll-list{
        padding-bottom: 0!important;
    }
</style>